/**
 * SEnc class
 *
 * @author 20175307gsc
 * @date 2019/05/03
 */

import java.io.*;
import java.security.*;
import javax.crypto.*;
import java.util.Scanner;

public class SEnc {
    public static void main(String[] args) throws Exception {
        Scanner reader = new Scanner(System.in);
        String s = reader.nextLine();
        FileInputStream f = new FileInputStream("key1.dat");
        ObjectInputStream b = new ObjectInputStream(f);
        Key k = (Key) b.readObject();
        Cipher cp = Cipher.getInstance("DESede");
        cp.init(Cipher.ENCRYPT_MODE, k);
        byte[] pText = s.getBytes("UTF8");
        for (byte i : pText) {
            System.out.print(i + ",");
        }
        System.out.println("");
        byte[] cText = cp.doFinal(pText);
        for (byte i : cText) {
            System.out.print(i + ",");
        }
        FileOutputStream f2 = new FileOutputStream("SEnc.dat");
        f2.write(cText);
    }
}